package pl.ydp.ivy.flex.ide.handlers;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;

public class RetrieveProjectHandler extends AbstractHandler {

	public Object execute(ExecutionEvent event) throws ExecutionException {
		String projectName = event.getParameter("pl.ydp.ivy.flex.ide.project");
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
		
		if ( project!=null )
			new RetrieveProjectJob( "Retrieve project: "+project.getName(), project ).schedule();
		
		return null;
	}

}
